<?php 
    echo form_hidden('field_id_' . $Field->id, set_value('field_id_' . $Field->id, $content));
    $content = unserialize($content);
    //print_r($content);
?>
<div>
    <input type="button" name="confirm_map" value="Confirm Map" id="confirm_map"/>
    <div id="confirm_info" style="margin: 20px 0; background-color: #ddd">
    </div>
</div>
<fieldset class="gllpLatlonPicker" id="map_start">
	<label class="place_name">Departure Place:</label>        
        <input type="text" class="gllpSearchField" name="field_id_<?php echo $Field->id?>[name1]" style="width: 40%" value="<?php echo $content['name1']?>">
        <input type="button" class="gllpSearchButton" value="search">
        <p style="color:#999; font-style:italic; margin-bottom: 20px">(Note: Moving a marker to location you want after search )<p>	
	<div class="gllpMap" style="width: 55%; height: 200px;">Google Maps</div>
	<input type="hidden" id="gllpLatitude1" class="gllpLatitude" value="<?php echo $content['lat1']?>" name="field_id_<?php echo $Field->id?>[lat1]" />
	<input type="hidden" id="gllpLongitude1" class="gllpLongitude" value="<?php echo $content['long1']?>" name="field_id_<?php echo $Field->id?>[long1]" />
	<input type="hidden" class="gllpZoom" value="12"/>
</fieldset>
<fieldset class="gllpLatlonPicker" id="map_destination" style="margin-top:30px">
        <label class="place_name">Destination Place:</label>
        <input type="text" class="gllpSearchField" name="field_id_<?php echo $Field->id?>[name2]" style="width: 40%" value="<?php echo $content['name2']?>">        
	<input type="button" class="gllpSearchButton" value="search">
        <p style="color:#999; font-style:italic; margin-bottom: 20px">(Note: Moving a marker to location you want after search )<p>
	<div class="gllpMap" style="width: 55%; height: 200px;">Google Maps</div>
	<input type="hidden" id="gllpLatitude2" class="gllpLatitude" value="<?php echo $content['lat2']?>" name="field_id_<?php echo $Field->id?>[lat2]" />
	<input type="hidden" id="gllpLongitude2" class="gllpLongitude" value="<?php echo $content['long2']?>" name="field_id_<?php echo $Field->id?>[long2]"/>
	<input type="hidden" class="gllpZoom" value="12"/> 
</fieldset>
<script>
jQuery(document).ready(function(){    
    $(".gllpSearchButton").click(function(){
        var html = '';
        $(".gllpSearchButton").each(function(){
            var parent = $($(this).parent());
            html += "<p style='padding-bottom:10px'><b>" + parent.find(".place_name").html() + " </b>" + parent.find(".gllpSearchField").val() + "     |     <b>Location: </b>" + parent.find(".gllpLatitude").val() + ", " + parent.find(".gllpLongitude").val() + "</p>";
        });
        $("#confirm_info").html(html);
    });
    $("#confirm_map").click(function(){
        var html = '';
        $(".gllpSearchButton").each(function(){
            var parent = $($(this).parent());
            html += "<p style='padding-bottom:10px'><b>" + parent.find(".place_name").html() + " </b>" + parent.find(".gllpSearchField").val() + "     |     <b>Location: </b>" + parent.find(".gllpLatitude").val() + ", " + parent.find(".gllpLongitude").val() + "</p>";
        });
        $("#confirm_info").html(html);
    });
});    
</script>